# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=grig
pkgver=0.8.0
pkgrel=1
pkgdesc='Rig control (cat) program.'
arch=('x86_64' 'aarch64')
url='http://groundstation.sourceforge.net/grig/'
license=('GPL')
depends=('hamlib' 'gtk2' 'intltool')
source=("http://downloads.sourceforge.net/groundstation/$pkgname-$pkgver.tar.gz"
        'g_thread.patch')
sha512sums=('204256a382dd2faf5c380d036d5c75748a24d683e1f3625cc75d5f41a3e73a57c5720cc6db3ad8968c741835516a241680af4e83c32dc0e0951731548fb82357'
            '7b6166dc68014acf66f0636e2ac387cdbd68125d86bb194fca5bd749475946192092916f443b138f8fd1fbfa204366ccf1e6793a3937c4e9448e4411f225854d')

prepare() {
  cd "$pkgname-$pkgver"

  sed -i -e "s:GtkTooltips:GtkTooltip:" src/grig-gtk-workarounds.c
	sed -i -e "s:GtkTooltips:GtkTooltip:" src/rig-gui-vfo.c
	sed -i -e "s:GtkTooltips:GtkTooltip:" src/rig-gui-buttons.c
	sed -i -e "s:GtkTooltips:GtkTooltip:" src/rig-gui-levels.c

  patch -p1 -i "$srcdir/g_thread.patch" src/main.c
}

build() {
	cd "$pkgname-$pkgver"

  if [[ "$CARCH" == "i686" || "$CARCH" == "x86_64" ]];
  then
    ./configure --prefix=/usr
  else
    ./configure --prefix=/usr --build=arm
  fi

  make
}

package() {
  cd "$pkgname-$pkgver"

  make DESTDIR="$pkgdir" install
}

